#include "client.h"

void handle_error(const char *msg) {
    perror(msg);
    exit(EXIT_FAILURE);
}

void *receive_messages(void *arg) {
    int client_socket = *((int *)arg);
    char buffer[BUFFER_SIZE] = {0};

    while (1) {
        int bytes_received = recv(client_socket, buffer, BUFFER_SIZE, 0);
        if (bytes_received <= 0) {
            printf("Server disconnected. Press Enter to exit.\n");
            break;
        }

        buffer[bytes_received] = '\0';
        printf("%s\n", buffer);

        // 更新状态逻辑...
    }

    return NULL;
}

// 其他函数实现（show_prompt, register_user, login_user, send_broadcast, send_private, show_help）...